import requests
import re
import os

url = 'http://www.nipic.com/design/acg/renwu/index.html'
data = requests.get(url).text

regex = r'data-src="(.*?.jpg)"'
pa = re.compile(regex)
ma = re.findall(pa, data)

# print(ma)

folder_path = 'picnic_img'
if os.path.exists(folder_path) == False:  
    os.makedirs(folder_path) 

i = 0
for image in ma:
    i += 1
    p = requests.get(image)
    with open('./' + folder_path + '/' + str(i) + '.jpg', 'wb') as fp:
        fp.write(p.content)
    # i += 1

    # with open('./folder_path/' + str(i) + '.jpg', 'w') as fp:
    #     fp.write(image.content)
